package org.fioma.general;

public class ReadChars implements Read {

	String id;
	char[] sequence;
	String quality;

	public ReadChars(String id, char[] sequence, String quality) {
		this.id = id;
		this.sequence = sequence;
		this.quality = quality;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fioma.general.ReadI#getId()
	 */
	@Override
	public String getId() {
		return id;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fioma.general.ReadI#setId(java.lang.String)
	 */
	@Override
	public void setId(String id) {
		this.id = id;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fioma.general.ReadI#getSequence()
	 */
	@Override
	public char[] getSequenceChars() {
		return sequence;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fioma.general.ReadI#setSequence(char[])
	 */
	@Override
	public void setSequence(char[] sequence) {
		this.sequence = sequence;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fioma.general.ReadI#getQuality()
	 */
	@Override
	public String getQuality() {
		return quality;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fioma.general.ReadI#setQuality(java.lang.String)
	 */
	@Override
	public void setQuality(String quality) {
		this.quality = quality;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fioma.general.ReadI#getLength()
	 */
	@Override
	public int getLength() {
		return sequence.length;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fioma.general.ReadI#getSequenceBytesInverted()
	 */
	@Override
	public byte[] getSequenceBytesInverted() {
		return Tools.getBytesInverted(sequence);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fioma.general.ReadI#getSequenceBytesComplementar()
	 */
	@Override
	public byte[] getSequenceBytesComplementar() {
		return Tools.getBytesComplementar(sequence);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fioma.general.ReadI#getSequenceBytes()
	 */
	@Override
	public byte[] getSequenceBytes() {
		return Tools.transformToBytes(sequence);
	}

	@Override
	public void setSequence(byte[] sequence) {
		setSequence(Tools.transformToChars(sequence));
	}

	@Override
	public void setSequence(String sequence) {
		setSequence(sequence.toCharArray());
	}

	@Override
	public String getSequence() {
		return new String(getSequenceChars());
	}

}
